/**
* 
* Copyright (c) 2009 by yuqiang @ vcedu
* 
* Description:
*		This file contains the video interface which would be used outside the lib
*
* \author yuqiang
* \version 1.0
*  
* ChangeLog:
*		$Date$	$Rev$	$Author$
* 
*/	

#ifndef  _IVIDEO_H_
#define  _IVIDEO_H_

#include "dllheader.h"

extern "C" {

	/**
	 *  \brief VideoParam define the parameters that needs by establish a video session.
	 *
	 *		  You should init this structure by calling librtp_video_param_init(pParam).
	 *		  After initialization, you can set the parameter that you want.
	 *
	 *   Some recommand resolution :
	 *        640 x 480    30f
	 *        320 x 240    25f
	 *        160 x 120    15f
	 */
	struct VideoParam{
		int m_devNum; /** device number, default 0 */
		int m_width; /** video window width, default 320 */
		int m_height; /** video window height, default 240 */
		float m_frameRate; /** video frame rate, default 25.0 */
		unsigned int m_portbase; /** listening port, default 6100 */
		bool m_acceptOwnPackets; /** whether user would accept is own packets, default true */
		int m_bandwidth; /** network bandwidth, default 200000 */
	};

	/**
	*   \brief init the Video Parameters
	*
	*   \param[in] pParam the video parameter
	*   
	*/
	LIBRTP_API void librtp_video_param_init(struct VideoParam *pParam);

	/**
	 *  \brief init the video session
	 *  
	 *  \param[in] pParam Video Parameter used to init video session
	 *
	 *  \return boolean value to indicate whether this init successful
	 */
	LIBRTP_API bool librtp_video_init(struct VideoParam *pParam);

	/**
	*   \brief close the video session
	*
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_close();

	/**
	 *   \brief add a destination, so user can receive our video
	 *   
	 *    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	 *    \param[in] port destination listening port
	 *
	 *    \return boolean value
	 */
	LIBRTP_API bool librtp_video_addDestination(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief delete a destination, so user can not receive our video
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_video_deleteDestination(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief clear all destinations
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_clearDestinations();

	/**
	*   \brief set the receive mode
	*   
	*	\param mode the receivde mode
	*
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_setReceiveMode(ReceiveMode mode);

	/**
	*   \brief add a user to ignore list, we would ignore all the packets sent by this user
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_video_addToIgnoreList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief delete a user from ignore list
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_video_deleteFromIgnoreList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief clear ignore list
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_clearIgnoreList();

	/**
	*   \brief add a user to Accept list, we would accept all the packets sent by this user
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_video_addToAcceptList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief delete a user from Accept list
	*   
	*    \param[in] ipAddr[4] ip Address in unsigned char format such as {192,168,0,1}
	*    \param[in] port destination listening port
	*
	*    \return boolean value
	*/
	LIBRTP_API bool librtp_video_deleteFromAcceptList(unsigned char ipAddr[4],unsigned int port);

	/**
	*   \brief clear Accept list
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_clearAcceptList();

	/**
	*   \brief start send chain, we would send our video to destinations
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_startSendChain();

	/**
	*   \brief stop send chain, we would stop sending our video to destinations
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_stopSendChain();

	/**
	*   \brief start receive chain, we would start to receive all incoming packets
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_startReceiveChain();

	/**
	*   \brief stop receive chain, we would stop receiving all incoming packets
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_stopReceiveChain();

	/**
	*   \brief start video session
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_startSession();

	/**
	*   \brief stop video session
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_stopSession();

	/**
	*   \brief check whether video session has been initialized
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_isInit();

	/**
	*   \brief check whether video session is running
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_isSessionRunning();

	/**
	*   \brief check whether video session is sending
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_isSendRunning();

	/**
	*   \brief check whether video session is receiving
	*   
	*   \return boolean value
	*/
	LIBRTP_API bool librtp_video_isReceiveRunning();

};


#endif _IVIDEO_H_